<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>修改密码</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="../../../layui/css/layui.css" media="all">
<script type="text/javascript" src="../../../layui/lay/modules/layer.js"></script>
<script type="text/javascript" src="../../../layui/jquery-3.2.1.min.js"></script>
<script src="../../../layui/layui.js" charset="utf-8"></script>
</head>
<body>
	<div style="height: 50%">
	<fieldset class="layui-elem-field layui-field-title"
		style="margin-top: 20px;">
		<legend align="center">修改个人密码</legend>
	</fieldset>
	<div align="center">	
		<form class="layui-form" action="">
		  <div class="layui-form-item" style="width: 45%">
		    <label class="layui-form-label">个人账号：</label>
		    <div class="layui-input-block">
		      <input name="Jpassword" lay-verify="title" id="jpassword" autocomplete="off" placeholder="请输您入个人账号" class="layui-input" type="text">
		    </div>
		  </div>
		  <div class="layui-form-item" style="width: 45%">
		    <label class="layui-form-label">新&nbsp;密&nbsp;码：</label>
		    <div class="layui-input-block">
		      <input name="xpassword" id="xpassword" lay-verify="title" autocomplete="off" placeholder="请输入您新密码" class="layui-input" type="text">
		    </div>
		  </div>
		  <div class="layui-form-item" style="width: 45%">
		    <label class="layui-form-label">确认密码：</label>
		    <div class="layui-input-block">
		      <input name="qpassword" id="qpassword" lay-verify="title" autocomplete="off" placeholder="请再次输入新密码" class="layui-input" type="text">
		    </div>
		  </div>
		  <input id="submit" type="button" class="layui-btn layui-btn-primary" value="确认" >
		  <button type="reset" class="layui-btn layui-btn-primary">重置</button>
		</form>
	</div>	
</div>
	<script>
		layui.use('element', function() {
			var $ = layui.jquery, element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
		});
	</script>
	<script type="text/javascript" src="../../../layui/lay/modules/layer.js"></script>
	<script type="text/javascript" src="../../../layui/layer.ext.js"></script>
	<script>
	
		$("#submit").click(function(){
			function getPath() {  
	        return 'http://'+location.host;
			};
			var x=$("#xpassword").val();
			var q=$("#qpassword").val();
			var j=$("#jpassword").val();
			if(j=="" || j==null){
				layer.alert("个人账号不能为空！"); 
			}else if(x=="" || x==null){
				layer.alert("新密码不能为空！");
			}else if(q==null || q==""){
				layer.alert("确认密码不能为空！");
			}else if(  x==q && (j!="" || j!=null)){
					 $.ajax({
							url : getPath()+'/wsyyt/mimacontroller/text',
							method : 'post',
							dataType : 'JSON',
							data: {'jpassword':j,'xpassword':x},
							success : function(result) {
								var code = result.code;
								if(code==0){
										layer.msg('提示：修改成功',{icon: 5});  
								}else{		
										layer.msg('提示：'+result.CW,{icon: 5});
								}
							}
					});		 
			}else if(x!=q){
				layer.alert("两次密码输入不一致");
			}
		});		
	</script>
</body>
</html>
